package com.coocaa.x.service.litedownloader2;

import com.coocaa.x.framework.app.CoocaaApplication;
import com.duowan.mobile.netroid.Network;
import com.duowan.mobile.netroid.RequestQueue;
import com.duowan.mobile.netroid.cache.DiskCache;
import com.duowan.mobile.netroid.stack.HurlStack;
import com.duowan.mobile.netroid.toolbox.BasicNetwork;
import com.duowan.mobile.netroid.toolbox.FileDownloader;

import org.apache.http.protocol.HTTP;

import java.io.File;

/**
 * Created by lu on 15-6-17.
 */
public class Netroid {
    private static final int TASK_SIZE = 10;
    private static FileDownloader filedownloader = null;
    private static RequestQueue mQueue = null;

    static {
        Network network = new BasicNetwork(new HurlStack("superx.cn", null), HTTP.UTF_8);
        mQueue = new RequestQueue(network, TASK_SIZE, new DiskCache(new File(CoocaaApplication.getContext().getCacheDir(), "cache")));
        mQueue.start();

        filedownloader = new FileDownloader(mQueue, 1);
    }

    public static FileDownloader getFileDownload() {
        return filedownloader;
    }
}
